package com.jeesite.modules.dp.web.patternstatics;

import com.jeesite.modules.dp.dto.vo.MarkStockSignalLineRecord;
import com.jeesite.modules.dp.dto.vo.MarkViewPieRecord;
import com.jeesite.modules.dp.entity.patrernstatics.MarketSectorNameEntity;
import com.jeesite.modules.dp.entity.patrernstatics.MarketStrongStockEntity;
import com.jeesite.modules.dp.service.patternstatics.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.Objects;

@RestController
@RequestMapping(value = "${adminPath}/dp/market")
public class PatternStaticsController {

    @Autowired
    private PatternStaticsService patternStaticsService;

    @Autowired
    private MarketViewSectorNameService marketViewSectorNameService;

    @Autowired
    private MarketStrongStockService marketStrongStockService;

    @Autowired
    private YearHighSectorDistributeService yearHighSectorDistributeService;

    @Autowired
    private HighSectorDistributeService highSectorDistributeService;

    @Autowired
    private MarketStockSignalService marketStockSignalService;

    /**
     * 查询最近的个股统计数据
     */
    @GetMapping("/pattern/getLatestStatics")
    public Map<String, Integer> getPatternLatestData() {
        return patternStaticsService.findLatestStatics();
    }

    @GetMapping("/sectors/getLatestStatics")
    public List<MarketSectorNameEntity> getMarketViewSectors() {
        return marketViewSectorNameService.findLatestStatics();
    }

    @GetMapping("/strongstock/getLatestStatics")
    public List<MarketStrongStockEntity> getMarketStrongStocks() {
        return marketStrongStockService.getLatestDataList();
    }

    @GetMapping("/disbute/sector-distribute")
    public List<MarkViewPieRecord> getYearHighSectorDistribute() {
        return yearHighSectorDistributeService.getDistributePieDatas();
    }

    @GetMapping("/disbute/stock-sector-distribute")
    public List<MarkViewPieRecord> getHighSectorDistribute() {
        return highSectorDistributeService.getDistributePieDatas();
    }

    @GetMapping("/disbute/getStockSignalList")
    public Map<String, Object> getStockSignalList() {
        return marketStockSignalService.getStockSignalList(30);
    }
}
